body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f9f9f9;
    position: relative;
}

a {
    text-decoration: none;
}

.container {
    width: 90%;
    margin: 0 auto;
}

.top {
    display: flex;
    align-items: center; /* 垂直居中 */
    justify-content: space-between; /* 左右布局 */
    padding: 10px 20px;
    background-color: #f9f9f9;
    position: relative;
    z-index: 2;
    border-bottom: 1px solid #ddd;
}

.top .title {
    flex-grow: 1; /* 占据剩余空间 */
    text-align: center; /* 居中 */
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin: 0;
}

.information {
    display: flex;
    align-items: center; /* 垂直居中 */
    position: relative;
}

#infor-img {
    width: 40px;
    height: 40px;
    border-radius: 50%; /* 圆形头像 */
    cursor: pointer;
    transition: transform 0.3s;
}

#infor-img:hover {
    transform: scale(1.1); /* 放大动画 */
}

.dropdown-content {
    display: none; /* 默认隐藏 */
    position: absolute;
    top: 40px;
    right: 0;
    background: #fff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    z-index: 5;
    width: 120px;
}

.dropdown-content a {
    display: block;
    padding: 10px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    border-bottom: 1px solid #eee;
}

.dropdown-content a:hover {
    background-color: #f0f0f0;
}

.information:hover .dropdown-content {
    display: block;
}

.dropdown-content a#logout {
    color: red;
}

.categories {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
}

.category {
    position: relative;
    padding: 15px;
    margin-bottom: 15px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden; /* 确保超出部分不影响布局 */
}

.category-name {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
    display: inline-block; /* 名称和操作按钮并排 */
    padding-right: 100px; /* 为按钮预留空间 */
}

.actions {
    display: flex !important; /* 确保始终显示 */
    gap: 5px;
    align-items: center;
}

.category:hover .actions {
    display: flex; /* 鼠标悬浮时显示 */
}

.actions a {
    padding: 2px 5px;
    transition: all 0.3s ease;
}

.actions a:hover {
    color: #007bff;
}

.actions a.delete:hover {
    color: #ff4444;
}

.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.product {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.product img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.product h3 {
    font-size: 16px;
    margin: 10px 0;
}

.product:hover {
    transition: transform 0.2s, box-shadow 0.2s;
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.small-category {
    display: none;
    flex-wrap: wrap;
    gap: 5px;
    padding: 5px;
}

.small-category span {
    display: inline-block;
    padding: 5px 10px;
    background-color: #f5f5f5;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.small-category span:hover {
    background-color: #e0e0e0;
}

.category:hover .small-category {
    display: flex;
}

.sub-category-item {
    position: relative;
    display: inline-block;
    margin: 5px;
}

.delete-small-icon {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    background-color: #ff4444;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: none;
    transition: transform 0.2s;
}

.category.delete-mode .delete-small-icon {
    display: block;
}

.delete-small-icon:hover {
    transform: scale(1.1);
    background-color: #ff0000;
}

.category.delete-mode .actions a.delete {
    color: #ff4444;
}

/* 添加编辑模式下的链接样式 */
.actions a.add-category {
    color: #28a745;
}

.actions a.add-category:hover {
    color: #218838;
    background-color: rgba(40, 167, 69, 0.1);
}

.actions a.modify-category {
    color: #007bff;
}

.actions a.modify-category:hover {
    color: #0056b3;
    background-color: rgba(0, 123, 255, 0.1);
}

.actions a.cancel-edit {
    color: #6c757d;
}

.actions a.cancel-edit:hover {
    color: #545b62;
    background-color: rgba(108, 117, 125, 0.1);
}
